package day13;

import org.junit.Before;
import org.junit.Test;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class TestLoop2 {
    List<Integer> list = new ArrayList();

    @Before
    public void test() {
        list.add(10);
        list.add(20);
        list.add(30);
        list.add(40);
    }

    @Test
    public void test1() {
        for (Integer s : list) {
            System.out.println(s);
        }
    }

    @Test
    public void test2() {
        Iterator<Integer> it = list.iterator();
        while (it.hasNext()) {
            Integer s = it.next();
            System.out.println(s);
        }
    }
}
